package com.zhz.config;

import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

@Component
public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102300743404";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCh1EmcdFwl3U5GD4SQiPwZXE/0hoy0FmD7JEcvOq7yk6DXTVmD3XaNLke/kPzp4UAcwupAqujNELh/zdYLDdTsM8YjoseStNSxJ/k794ruiMnyuUeDm2M1gyL6E+sp+BncTd2jvM5lyHNydQ9RCgOEY5D2TyFEYCANAOyKlZlsEq+NyDYEn1gn60YyhWKd17qj28g7eOm/SIeHyo0CpdKyc4UqxXuJERBVzgKGzbtyxNc3D5NcZSXVbcFN/XXcYwj0BTru9cpq147ayWu9C0Pi+Ch1fTyVCGU7CpJhqeBeuRGkGzV+RqaTLsNwnrLLGrU7UwwcXLy3GSU9qIfv1aTDAgMBAAECggEAKajDlmIiAqFY8BI4lxichU7NSm6EtCt6pcwuAwuBU/MLGcHQxHBzf16lm7wQT4jr/ztyIFme+oNOa6AqdMgHwxKE9FGIPM0OX9ihgX11J3jRPAnUTh3nSTRMAcK07CXxSlRFNUx6eZtDlPhri/oe86rJ+45dSwPP3Gkbe4WNbFNtFQYaNlqPUC7/++9Hm0EBzcb4khfpJ9nJIzfHSocyNlXuctcCMGnyitkBpSPIvFCSXOtl+rHn7d0JBVUMM3STMsXExZmQ2gVkFW6VHawyJERJll2HkHMtVhnDfVXK2UAiOfOwVHxlrCEc/GpSMRW7Eu6PuYdRStcJNLKx8OUjaQKBgQDtPb1aan4/19CZZf0OsfSCRh8b1mxlzaWSYF5d8fmLx9+629Dj2yCwyRAXd9KsQ/yEqFfj1aYrbQCYUDSb8nUltiBBj8pPBgf2tfVB4oTFLKURQOeBkoYZV+0sNil+Flgch41gTpikB6m2ZlOSV2eaQEg+spHuzUDiDox6HiI/BwKBgQCuoA1MGE3kwXLwfbMj+pERRCBzv9PSWfVeHL3MATvPv0DiC0HnRpJi6AUnCfthPfeMe/dTqWe0BPYq6bF1xezBPy9Jtlq2Mv24uZ1U5fY5ROSFKUdMHmcT3FSfljNXyB0L9lUEY8qQoEQLPd14cItsTZQ1N4zxW4ILEyFa7J5BZQKBgQDLGt9ASAmbyLzqhxkV+p4U5cl+QJ1+roeAgIZpsV5uIAjXZZc5a4FaOFhRbyDqoC3QuHq+MEvZw7ENtSTFGdbXGUwWNO8Dpmss+OxmonH+iFEtKz7HfFTX36HKBviQ3LpEenw7pi4hx/mwkXwcvj2RHlV7b89l/Uz9+2yio6e4AwKBgQCniZ1YXZUWHVeGTkM6CKN32lH8W5YBohdcdNzPxns5BThd5wkSuE2oIQ0YeGY61LYVjbYsCUManwwC/fUplnxgp5tZ8F+1oNR2j3bYRk1mgqdw7rqd2ClzD5gNCJE37iGYIX1N2eQ1v92on3FFpUzO2tuP9zz9L5tjvrXow03OVQKBgHb/AwBP7q/Z3K2Zumtwtaqkrlr6ZbulPzU+0a5lUU73R17q5IGaUcORsDCFGuC12dzXsh+ti/W64qzFxWwb48ofupOKIpmnxS8KbbgCcAGIZ2UpjlXrLUnoGtob5C3Mnsw4CaeE3Q1RRvHTfSU4r82DZh8qo4O0iHOR+MH4pZHr";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiJ3lMCtsmGCf658eU5l5k8ej/gDeZwQzOsN5dPSz4njvsJUZ2VUZw+Xh7KtFPPPWzzWegrTi63I7Ug6WtOruMFbNm9DexMQEmj7IcA1jUlKOCReJmdiy9yLEePg4I3gVgtt5Jnt4kQncYnA3W5eSwpndYG1yRZlnZgWnSo8fqBUu2mRsoL6pOV2r8Fl3sUPB+KgwOvaDFx4IKKHc1WNM7R2RYqMXyBEYRYwfR7SnD5/2YbowcxptuX8HVWdi5F2Gp1CVBI4Yte6DczCiNBEvf7Y6KBKNhr3C2L58+eXqBjlScdR5bQTbxcODGLgl+/Czrt03WvY0BIUt7j/PPOdh1QIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://lch6666.mynatapp.cc/Alipay/notify_url";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://lch6666.mynatapp.cc/Alipay/return_url";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "D:\\Project_Practice\\Pay";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
